var express = require('express');
var router = express.Router();

var URL = require('url');
var User = require('./user')

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});


/* 获取用户信息接口 */
router.get('/getUserInfo', (req, res) =>{
  var user = new User()
  // var params = URL.parse(req.url, true).query
  console.log('进入了后台接口方法中：getUserInfo')
  if('1'){
    user.originW = 22
    user.targetW = 22
    user.yesterdayFood = 22
    user.breakfisrt = 22
    user.lunch = '大碴粥 红烧肉'
    user.dinner = '红烧配股、地瓜粥'
    user.drink = 6
    user.defecation = '4次厕所'
    user.yesterdayW = 78
    user.todayW = 78
    user.constrat4yesterday = 2
    user.totalDay = 29
    user.totalKillFat = 28
  }else{
    user.originW = 123456
    user.targetW = 123456
    user.yesterdayFood = 123456
    user.breakfisrt = 123456
    user.lunch = '宫保鸡丁 东坡肉'
    user.dinner = '日本豆腐、酸菜猪肉炖粉条'
    user.drink = 6
    user.defecation = '4次厕所'
    user.yesterdayW = 78
    user.todayW = 78
    user.constrat4yesterday = 2
    user.totalDay = 29
    user.totalKillFat = 28
  }

  var response = {status: 1, data: user}
  res.send(JSON.stringify(response))
})

module.exports = router;
